package main.function;

import main.impl.DisplayImpl;

import java.util.Random;

/**
 * 在 CountDisplay 类的基础 增加新功能，随机显示次数
 */
public class RandomDisplay extends CountDisplay{
    public RandomDisplay(DisplayImpl impl) {
        super(impl);
    }

    public void randomDisplay(int times){
        open();
        int randoms = new Random().nextInt(times);
        for (int i = 0; i < randoms; i++) {
            print();
        }
        close();
    }
}
